import React from 'react';
import { Row, Col } from 'antd';
import moment from 'moment';
import BannerImage from './BannerImage';
import style from './index.less';

const meridiem = (hour, minute) => {
  if (hour < 9) {
    return '早上';
  }
  if (hour < 11 && minute < 30) {
    return '上午';
  }
  if (hour < 13 && minute < 30) {
    return '中午';
  }
  if (hour < 18) {
    return '下午';
  }
  return '晚上';
};

const hello = () => {
  const now = moment();
  return meridiem(now.hour(), now.minute());
};

const Welcome = () => (
  <Row type="flex" justify="space-around" align="middle" style={{ paddingTop: 30 }}>
    <Col span={20}>
      <Row gutter={8}>
        <Col span={10} style={{ paddingTop: 150 }}>
          <h1 className={style.title}>{hello()}好！</h1>
          <p className={style.desc}>欢迎使用变应原制剂的临床管理系统</p>
        </Col>
        <Col span={4}>
          <BannerImage />
        </Col>
      </Row>
    </Col>
  </Row>
);

export default Welcome;
